package pers.vic.practice.config.web;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import pers.vic.practice.base.constant.BaseConstant;
import pers.vic.practice.base.web.AuthenticationInterceptor;

/**
 * 拦截器
 * @author Vic.xu
 * @date 2021/08/11
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new AuthenticationInterceptor()).addPathPatterns("/**")
                .excludePathPatterns(BaseConstant.LOGIN_PAGE)
                .excludePathPatterns("/error/*")
                .excludePathPatterns("/lib/**","/css/**","/js/**","/img/**");;

    }
}